package com.spring.demo.controller;


import com.spring.demo.entity.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

@Controller
public class UserController2 {
    @Autowired
    private User user;

    public void printUser2(){
        System.out.println("user-->"+user);
        //此时拿到的还是“jack”,因为现在Bean默认作用域是单例模式
        //整个spring框架中只有一份
    }

}
